# -*- conding:utf-8 -*-

"""
@author: PoXiao
@file: main2.py
@time: 2019/3/25 0025 20:00

"""
from traffic_fitness import *
from creat_crossMap import *
from creat_roadMap import *
import scipy.io
data1 = scipy.io.loadmat('bianld.mat')
data2 = scipy.io.loadmat('pop8.mat')
road = data1['road']
car = data1['car']
cross = data1['cross']
pop = data2['pop']
chromosome = pop[2,:]
crossMap = creat_crossMap(cross)
crossMap = np.array(crossMap, dtype=np.int)
road = creat_roadMap(road, crossMap)
road = np.array(road, dtype=np.int)

for i in range(0, 100):
    fitness = traffic_fitness(pop[i, :], road, car, cross, crossMap)
    print(fitness)
